package com.money.search.controller;

import com.money.common.dto.es.SkuEsModel;
import com.money.common.utils.R;
import com.money.search.service.EsSaveService;
import com.money.search.vo.Demo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.io.IOException;
import java.util.Date;
import java.util.List;

@RestController
@RequestMapping("search/save")
public class EsSaveController {

    @Autowired
    EsSaveService esSaveService;

    @RequestMapping("demo")
    public R demo(){
        return R.ok().put("data",new Demo());
    }

    @PostMapping("saveSkuToEs")
    public R saveSkuToEs(@RequestBody List<SkuEsModel> models) throws IOException {
        boolean result = esSaveService.saveSkusToEs(models);
        return R.ok().put("data",result);
    }


}
